package com.mTwoDimensionalArray;

public class ArrReverse02 {
    public static void main(String[] args) {
        int[] arr = {1,3,4,2,8};
        //优化后
        int start = 0,end = arr.length - 1;
        while(start < end){

            int temp = arr[start];
            arr[start] = arr[end];
            arr[end] = temp;

            start++;
            end--;
        }
        /*
        for (int start = 0,end = arr.length-1;start < end;start++,end--){
            int temp = arr[start];
            arr[start] = arr[end];
            arr[end] = temp;
        }

         */

        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i] + " ");
        }
    }
}
